#include "Functions.h"

int main(int argc, char **argv) {
	FileStruct *file = NULL;
	char **code = NULL, *finalcode = NULL;
	int i;

    if(argc < 2) {
       	printf("Usage: <%s> <filename>\n", argv[0]);
       	exit(1);
    }

    file = ReadFile(file, argv[1]);     /* obtem a estrutura do arquivo de entrada */
    code = HuffmanTree(file);   /* gera as estruturas necessarias para compressao */

	/*for(i = 0; i < 8; i++)
		printf("Symbol: %d, huffman code: %s\n", i, code[i]); */

    finalcode = GenerateFinalCode(code, file);
    WriteFileCode(finalcode, argv[1], code); 



    	return 0;
}
